<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>黔南民族师范学院综合教育学分认定系统</title>

    <link rel="stylesheet" href="/jquery-easyui-1.3.5/themes/icon.css" />
    <link rel="stylesheet" href="/jquery-easyui-1.3.5/themes/default/easyui.css"/>

    <script type="text/javascript" src="/jquery-easyui-1.3.5/jquery.min.js"></script>
    <script type="text/javascript" src="/jquery-easyui-1.3.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/jquery-easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
    <style type="text/css">
        form div{
            margin:20px auto;
            width:250px;
            text-align:center;
        }
    </style>
    <script type="text/javascript"  th:inline="none">
        $(function(){
            //完成数据回显
            var dg = parent.$("iframe[title='专业信息管理']").get(0).contentWindow.$("#dg");

            $("#cc").combobox({
                url:'/school/queryAll',
                valueField:'id',
                textField:'name',
                panelHeigth:'auto',
                panelWidth:140,
                width:160,
                editable:false,
                required:true,
                missingMessage:'请选择所属学院'
            });

            var rows = dg.datagrid("getSelections");
            $("#ff").form('load',{
                id:rows[0].id,
                code:rows[0].code,
                name:rows[0].name,
                year:rows[0].year,
                sid:rows[0].sid
            });

            $("input[name=code]").validatebox({
                required:true,
                missingMessage:'请输入专业代码'
            });
            $("input[name=name]").validatebox({
                required:true,
                missingMessage:'请输入专业名称'
            });
            $("#ff").form("disableValidation");

            $("#btn").click(function(){
                $("#ff").form("enableValidation");
                if($("#ff").form("validate")){
                    $("#ff").form('submit',{
                            url:'/major/majorUpdate',
                            success:function(){
                                parent.$("#win").window("close");
                                dg.datagrid("reload");
                            }
                        }
                    );
                }
            });
        });

    </script>
</head>

<body>
<form id="ff" method="post">
    <div>
        <label>所属学院:</label>
        <input id="cc" name="sid"></input>
    </div>
    <div>
        <label>专业代码:</label>
        <input type="text" name="code" />
    </div>
    <div>
        <label>专业名称:</label>
        <input type="text" name="name" />
    </div>
    <div>
        <label>学制年数:</label>
        <input type="text" name="year" />
    </div>
    <div>
        <a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-edit'">更新专业</a>
        <input type="hidden" name="id" />
    </div>
</form>
</body>
</html>
